package model

import "strconv"

const TableByGoodsSku = "self_goods_sku"

// GoodsByUpDownNo 上下架:1=上架,0=下架
const GoodsSkuByIsUpDownNo = 0  //下架
const GoodsSkuByIsUpDownYes = 1 //上架


// SkuMaxOrMinByPrice 获取sku种的最大价格和最小价格
func SkuMaxOrMinByPrice(data []map[string]interface{}) (float32, float32) {
	var max float64
	var min float64
	for key, datum := range data {
		flo, _ := strconv.ParseFloat(datum["price"].(string), 64)
		if flo > max || key == 0 {
			max = flo
		}
		if flo < min || key == 0 {
			min = flo
		}
	}
	return float32(max), float32(min)
}


